<app:page xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:app="http://java.sun.com/jsf/composite/app"
          xmlns:ds="http://deltaset.org/deltaset-faces"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          pageTitle="#{locationMsg['view.title']}">    

    <ds:titlebar title="#{locationMsg['view.title']}">
        <h:button outcome="/secured/location/form" 
                  value="#{deltasetMessages['deltaset.crud.add']}"
                  styleClass="ds-button"/>
        <h:button outcome="/secured/location/list" 
                  value="#{deltasetMessages['deltaset.crud.list']}"
                  styleClass="ds-button"/>
    </ds:titlebar>
    <c:set target="#{viewScope}" property="locationModel" value="#{locationBean.loadModel(param.locationId)}"/>
    
    <h:form>
        <ds:fieldset>
            <h:messages styleClass="ui-state-highlight ui-corner-all"/>

            <ds:inputText label="#{locationMsg['locationName']}"
                          value="#{viewScope.locationModel.locationName}"
                          requiredMessage="#{deltasetMessages['deltaset.crud.required']}"
                          required="true"/>                        
        </ds:fieldset>


        <ui:include src="/secured/address/many-to-one.xhtml">
            <ui:param name="addressModel" value="#{viewScope.locationModel.address}"/>
            <ui:param name="addressTarget" value="viewScope.locationModel.address"/>
        </ui:include>     
        
        <div class="ds-margin-top">
            <h:commandButton action="#{locationBean.save(viewScope.locationModel)}"
                             value="#{deltasetMessages['deltaset.crud.save']}"
                             styleClass="ds-button">               
            </h:commandButton>
            <h:commandButton value="#{deltasetMessages['deltaset.crud.delete']}"
                             action="#{locationBean.delete(viewScope.locationModel)}"
                             onclick="return deltaset.confirm(this)"
                             disabled="#{locationBean.isNew(viewScope.locationModel)}"
                             styleClass="ds-button">               
            </h:commandButton>
        </div>
    </h:form>
</app:page>